package com.wzj.uarmor.utils;


public enum ResponseStatus {

    /**
     * 成功
     */
    SUCCESS(200, "操作成功！"),
    ERROR(500, "服务器出现故障,请联系管理员！"),
    UNAUTHORIZED(401, "尚未登录！"),
    FORBIDDEN(402, "您没有操作权限！"),
    NOT_FOUND(404, "资源不存在！"),
    LOGIN_ERROR(501, "账号或密码错误！"),
    USER_EXIST(600, "已存在的用户！"),

    USER_NOT_EXIST(601, "用户不存在！"),

    INVALID_AUTHCODE(601, "手机验证码无效！"),
    INVALID_TOKEN(403, "无效的TOKEN，您没有操作权限！"),
    INVALID_ACCESS(405, "无效的请求，该请求已过期！"),
    DELETE_ERROR(500, "删除失败！");

    private Integer code;
    private String message;

    ResponseStatus(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static ResponseStatus getResponseStatus(String message) {
        for (ResponseStatus ut : ResponseStatus.values()) {
            if (ut.getMessage() == message) {
                return ut;
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
